package demo01.service;

import com.alibaba.csp.sentinel.annotation.SentinelResource;
import com.alibaba.csp.sentinel.slots.block.BlockException;
import demo01.handler.HelloServiceBlockHandler;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

@Slf4j
@Service
public class HelloService {

    @SentinelResource(value="sayHi",blockHandler = "blockHandle",blockHandlerClass = HelloServiceBlockHandler.class)
    public String sayHi(String name){
        return "hello sentinel! hello "+name;
    }
//    // 处理的是熔断和限流的降级逻辑
//    public String blockHandle(String name, BlockException e){
//        log.info("当前处理的方法正在处理降级逻辑",e);
//        return " sayHi方法 被sentinel限制流量啦";
//    }

}
